<form class="layui-form seller-form"  action="" >
    <div class="layui-form-item" style="margin-bottom:0;">
        <div class="layui-inline">
            <label class="layui-form-label">支付单号：</label>
            <div class="layui-input-inline seller-inline-3">
                <input type="text" name="payment_id" lay-verify="title"  placeholder="请输入支付单号" autocomplete="off" class="layui-input">
            </div>
        </div>
        <div class="layui-inline">
            <label style="width:120px" class="layui-form-label">第三方支付单号：</label>
            <div class="layui-input-inline seller-inline-5">
                <input type="text" name="trade_no" lay-verify="title" placeholder="请输入第三方支付单号" autocomplete="off" class="layui-input">
            </div>
        </div>

        <div class="layui-inline">
            <label style="width:120px" class="layui-form-label">用户手机号码：</label>
            <div class="layui-input-inline seller-inline-3">
                <input type="text" name="mobile" lay-verify="title" placeholder="请输入手机号码" autocomplete="off" class="layui-input">
            </div>
        </div>
        <div class="layui-inline">
            <label class="layui-form-label">支付状态：</label>
            <div class="layui-input-inline" style="width:98px;" >
                <select name="status" lay-verify="">
                    <option value=""></option>
                    <option value="1">待支付</option>
                    <option value="2">支付成功</option>
                    <option value="3">其他</option>
                </select>
            </div>
        </div>
        <div class="layui-inline">
            <label class="layui-form-label">单据类型：</label>
            <div class="layui-input-inline" style="width:85px;" >
                <select name="type" lay-verify="">
                    <option value=""></option>
                    <option value="1">订单</option>
                    <option value="2">充值</option>
                </select>
            </div>
        </div>
        <div class="layui-inline">
            <button class="layui-btn layui-btn-sm" lay-submit="" lay-filter="*"><i class="iconfont icon-chaxun"></i>筛选</button>
        </div>

    </div>
</form>
<div class="table-body">
    <table id="billPayments" lay-filter="test"></table>
</div>




<script>
    layui.use(['form', 'layedit', 'laydate','table'], function(){
        layui.table.render({
            elem: '#billPayments',
            height: 'full-330',
            cellMinWidth: '80',
            page: 'true',
            limit:'20',
            url: "{:url('billPayments/index')}?_ajax=1",
            id:'billPayments',
            cols: [[
                {field:'payment_id', width:140, sort: true,title:'支付单号'},
                {field:'status', width:100,title:'状态'},
                {field:'payment_code', width:120,title:'支付方式'},
                {field:'type', width:100,title:'单据类型'},
                {field:'user_id', width:150,minWidth: 50,title:'用户'},
                {field:'money',width:100,title:'金额'},
                {field:'trade_no',title:'第三方支付单号'},
                {field:'utime',title:'支付时间'},
                {field: 'operating', title: '操作', width:100, align: 'center', fixed: 'right',templet:function(data){
                    var html = '';
                    html += '<a  class="layui-btn layui-btn-xs option-view layui-btn-primary" data-id="' + data.payment_id + '">明细</a>';
                    return html;
                }},
            ]]
        });
        layui.form.on('submit(*)', function(data){
            layui.table.reload('billPayments', {
                where: data.field
                ,page: {
                    curr: 1 //重新从第 1 页开始
                }
            });
            return false; //阻止表单跳转。如果需要表单跳转，去掉这段即可。
        });
        //查看操作
        $(document).on('click','.option-view',function(){
            $.ajax({
                type:'get',
                url: "{:url('billPayments/view')}",
                data:'payment_id='+$(this).attr('data-id'),
                success:function(e){
                    if(e.status){
                        window.box = layer.open({
                            type: 1,
                            content: e.data,
                            area: ['600px', '600px'],
                            title:'支付单查看'
                        });
                    }else{
                        layer.msg(e.msg);
                    }

                }
            });
        });
    });
</script>
